package com.whfc.fse.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 特种设备报警规则类型
 * @author: sunguodong
 * @version: 1.0
 * @date: 2019/7/22 11:47
 */
public enum FseWarnRuleType {
    UNKNOW_TYPE(-100,-1,"未知报警",null,null),
    CRANE_UNKNOW_TYPE(-1,1,"特种设备塔吊报警",null,null),
    CRANE_ANTI_COLLISION(101, 1, "特种设备塔吊防碰撞报警", "出现防碰撞报警", "碰撞"),
    CRANE_WEIGHT(102, 1, "特种设备塔吊起重量报警", "出现起重量报警", "起重"),
    CRANE_FORCE_MOMENT(103, 1, "特种设备塔吊力矩报警", "出现力矩报警", "力矩"),
    CRANE_TURN(104, 1, "特种设备塔吊倾角报警", "出现倾角报警", "倾角"),
    CRANE_WIND_SPEED(105, 1, "特种设备塔吊风速报警", "出现风速报警", "风速"),
    CRANE_RANGE(106, 1, "特种设备塔吊幅度报警", "出现幅度报警", "幅度"),
//    CRANE_MAX_RANGE(104, 1, "特种设备塔吊最大幅度报警", "出现最大幅度报警", "大幅"),
//    CRANE_MIN_RANGE(105, 1, "特种设备塔吊最小幅度报警", "出现最小幅度报警", "小幅"),
    CRANE_HEIGHT_RANGE(107, 1, "特种设备塔吊高度限位报警", "出现高度限位报警", "高度"),
    CRANE_ROTARY_LIMIT(108, 1, "特种设备塔吊回转限位报警", "出现回转限位报警", "回转"),
//    CRANE_LEFT_ROTARY_LIMIT(107, 1, "特种设备塔吊回转左限位报警", "出现回转左限位报警", "左限"),
//    CRANE_RIGHT_ROTARY_LIMIT(108, 1, "特种设备塔吊回转右限位报警", "出现回转右限位报警", "右限"),


    LIFT_HIGT(201, 2, "特种设备升降机高度报警", "出现高度报警", "高度"),
    LIFT_WEIGH(202, 2, "特种设备升降机重量报警", "出现重量报警", "重量"),
    LIFT_SPEED(203, 2, "特种设备升降机运行速度报警", "出现运行速度报警", "运行速度"),
    LIFT_FRONT_GATE(204, 2, "特种设备升降机前门未关报警", "出现前门未关报警", "前门"),
    LIFT_BACK_GATE(205, 2, "特种设备升降机后门未关报警", "出现后门未关报警", "后门"),
    LIFT_WIND_SPEED(206, 2, "特种设备升降机风速报警", "出现风速报警", "风速"),
    LIFT_TURN(207, 2, "特种设备升降机倾角报警", "出现倾角报警", "倾角"),
    LIFT_PERSON(208, 2, "特种设备升降机人数报警", "出现人数报警", "人数"),

    GANTRY_MAIN_OVERLOAD(305, 3, "特种设备龙门吊主起升超载报警", "主起升超载报警", "主起升"),
    GANTRY_AUX_OVERLOAD(306, 3, "特种设备龙门吊副起升超载报警", "副起升超载报警", "副起升"),
    GANTRY_WIND_SPEED(307, 3, "特种设备龙门吊升风速报警", "风速报警", "风速"),
    BRIDGE_FRONT_OVERLOAD(408, 4, "特种设备桥架机前天车超载报警", "前天车超载报警", "前天车"),
    BRIDGE_AFTER_OVERLOAD(409, 4, "特种设备桥架机后天车超载报警", "后天车超载报警", "后天车"),
    BRIDGE_WIND_SPEED(410, 4, "特种设备桥架机风速报警", "风速报警", "风速"),
    CRAWLER_TURN(501, 5, "特种设备履带吊回转报警", "回转报警", "回转"),
    CRAWLER_MAIN_HOOK_HEIGHT(502, 5, "特种设备履带吊主钩高度报警", "高度报警", "高度"),
    CRAWLER_MAIN_HOOK_WEIGHT(503, 5, "特种设备履带吊主钩重量报警", "重量报警", "重量"),
    CRAWLER_VICE_HOOK_HEIGHT(504, 5, "特种设备履带吊副钩高度报警", "高度报警", "高度"),
    CRAWLER_VICE_HOOK_WEIGHT(505, 5, "特种设备履带吊副钩重量报警", "重量报警", "重量"),
    CRAWLER_DIP_ANGLE(506, 5, "特种设备履带吊防后倾报警", "防后倾报警", "防后倾"),
    CRAWLER_WIND_SPEED(507, 5, "特种设备履带吊风速报警", "风速报警", "风速"),
    CRAWLER_ABNORMAL_OP(508, 5, "特种设备履带吊非正常操作报警", "非正常操作报警", "非正常操作"),
    CRAWLER_ANTI_COLLISION(509, 5, "特种设备履带吊防撞探头报警", "防撞探头报警", "防撞探头");


    private final Integer value;

    private final Integer type;

    private final String tittle;

    private final String detail;

    private final String pic;

    FseWarnRuleType(Integer value, Integer type, String tittle, String detail, String pic) {
        this.value = value;
        this.type = type;
        this.tittle = tittle;
        this.detail = detail;
        this.pic = pic;
    }

    public Integer value() {
        return value;
    }

    public Integer type() {
        return type;
    }

    public String tittle() {
        return tittle;
    }

    public String detail() {
        return detail;
    }

    public String pic() {
        return pic;
    }

    public static FseWarnRuleType parseByValue(Integer value) {
        switch (value) {
            case -1:
                return CRANE_UNKNOW_TYPE;
            case 101:
                return CRANE_ANTI_COLLISION;
            case 102:
                return CRANE_WEIGHT;
            case 103:
                return CRANE_FORCE_MOMENT;
            case 104:
                return CRANE_TURN;
            case 105:
                return CRANE_WIND_SPEED;
            case 106:
                return CRANE_RANGE;
            case 107:
                return CRANE_HEIGHT_RANGE;
            case 108:
                return CRANE_ROTARY_LIMIT;


            case 201:
                return LIFT_HIGT;
            case 202:
                return LIFT_WEIGH;
            case 203:
                return LIFT_SPEED;
            case 204:
                return LIFT_FRONT_GATE;
            case 205:
                return LIFT_BACK_GATE;
            case 206:
                return LIFT_WIND_SPEED;
            case 207:
                return LIFT_TURN;
            case 208:
                return LIFT_PERSON;

            case 305:
                return GANTRY_MAIN_OVERLOAD;
            case 306:
                return GANTRY_AUX_OVERLOAD;
            case 307:
                return GANTRY_WIND_SPEED;
            case 408:
                return BRIDGE_FRONT_OVERLOAD;
            case 409:
                return BRIDGE_AFTER_OVERLOAD;
            case 410:
                return BRIDGE_WIND_SPEED;
            case 501:
                return CRAWLER_TURN;
            case 502:
                return CRAWLER_MAIN_HOOK_HEIGHT;
            case 503:
                return CRAWLER_MAIN_HOOK_WEIGHT;
            case 504:
                return CRAWLER_VICE_HOOK_HEIGHT;
            case 505:
                return CRAWLER_VICE_HOOK_WEIGHT;
            case 506:
                return CRAWLER_DIP_ANGLE;
            case 507:
                return CRAWLER_WIND_SPEED;
            case 508:
                return CRAWLER_ABNORMAL_OP;
            case 509:
                return CRAWLER_ANTI_COLLISION;
            default:
                return null;
        }
    }


    public static List<FseWarnRuleType> getRuleTypeList(Integer type) {
        List<FseWarnRuleType> list = new ArrayList<>();
        if (type == null) {
            return list;
        }
        FseWarnRuleType[] ruleTypes = FseWarnRuleType.values();
        for (FseWarnRuleType ruleType : ruleTypes) {
            if (type.equals(ruleType.type)) {
                list.add(ruleType);
            }
        }
        return list;
    }

    public static FseWarnRuleType parseByTittle(String tittle) {
        switch (tittle) {
            case "特种设备塔吊报警":
                return CRANE_UNKNOW_TYPE;
            case "特种设备塔吊防碰撞报警":
                return CRANE_ANTI_COLLISION;
            case "特种设备塔吊起重量报警":
                return CRANE_WEIGHT;
            case "特种设备塔吊力矩报警":
                return CRANE_FORCE_MOMENT;
            case "特种设备塔吊倾角报警":
                return CRANE_TURN;
            case "特种设备塔吊风速报警":
                return CRANE_WIND_SPEED;
            case "特种设备塔吊幅度报警":
                return CRANE_RANGE;
            case "特种设备塔吊高度限位报警":
                return CRANE_HEIGHT_RANGE;
            case "特种设备塔吊回转限位报警":
                return CRANE_ROTARY_LIMIT;


            case "特种设备升降机高度报警":
                return LIFT_HIGT;
            case "特种设备升降机重量报警":
                return LIFT_WEIGH;
            case "特种设备升降机运行速度报警":
                return LIFT_SPEED;
            case "特种设备升降机前门未关报警":
                return LIFT_FRONT_GATE;
            case "特种设备升降机后门未关报警":
                return LIFT_BACK_GATE;
            case "特种设备升降机风速报警":
                return LIFT_WIND_SPEED;
            case "特种设备升降机倾角报警":
                return LIFT_TURN;
            case "特种设备升降机人数报警":
                return LIFT_PERSON;


            case "特种设备龙门吊主起升超载报警":
                return GANTRY_MAIN_OVERLOAD;
            case "特种设备龙门吊副起升超载报警":
                return GANTRY_AUX_OVERLOAD;
            case "特种设备龙门吊升风速报警":
                return GANTRY_WIND_SPEED;
            case "特种设备桥架机前天车超载报警":
                return BRIDGE_FRONT_OVERLOAD;
            case "特种设备桥架机后天车超载报警":
                return BRIDGE_AFTER_OVERLOAD;
            case "特种设备桥架机风速报警":
                return BRIDGE_WIND_SPEED;
            case "特种设备履带吊回转报警":
                return CRAWLER_TURN;
            case "特种设备履带吊主钩高度报警":
                return CRAWLER_MAIN_HOOK_HEIGHT;
            case "特种设备履带吊主钩重量报警":
                return CRAWLER_MAIN_HOOK_WEIGHT;
            case "特种设备履带吊副钩高度报警":
                return CRAWLER_VICE_HOOK_HEIGHT;
            case "特种设备履带吊副钩重量报警":
                return CRAWLER_VICE_HOOK_WEIGHT;
            case "特种设备履带吊防后倾报警":
                return CRAWLER_DIP_ANGLE;
            case "特种设备履带吊风速报警":
                return CRAWLER_WIND_SPEED;
            case "特种设备履带吊非正常操作报警":
                return CRAWLER_ABNORMAL_OP;
            case "特种设备履带吊防撞探头报警":
                return CRAWLER_ANTI_COLLISION;
            default:
                return CRANE_ANTI_COLLISION;
        }
    }


}
